CentOS 5
Sponsored Link

Install Nagios
  Install Nagios in order to watch server's status. httpd is also needed.

[1] Install Nagios
[root@ns ~]#
yum --enablerepo=dag -y install nagios nagios-plugins
 
# install from DAG


[root@ns ~]#
vi /etc/nagios/nagios.cfg


# line 52: uncomment

cfg_dir=/etc/nagios/servers

[root@ns ~]#
vi /etc/httpd/conf.d/nagios.conf


# line 16: add IPs you allow

Allow from
127.0.0.1 192.168.0.


# line 33: add IPs you allow

Allow from
127.0.0.1 192.168.0.


[root@ns ~]#
mkdir /etc/nagios/servers

[root@ns ~]#
chown nagios. /etc/nagios/servers

[root@ns ~]#
vi /etc/nagios/objects/contacts.cfg


# line 35: change to admin's email address

      email
webmaster@localhost


[root@ns ~]#
htpasswd -c /etc/nagios/htpasswd.users nagiosadmin

New password:
# set password

Re-type new password:
Adding password for user nagios
[root@ns ~]#
/etc/rc.d/init.d/httpd restart

Stopping httpd:
[  OK  ]

Starting httpd:
[  OK  ]

[root@ns ~]#
/etc/rc.d/init.d/nagios start

Starting nagios: done.
[root@ns ~]#
chkconfig nagios on
[2] Access with web browser to 'http://(your hostname or IP address)/nagios/', then following screen is shown. Input nagiosadmin for user and password set with htpasswd in [1].
 
[3] Just logined.
 
[4] Click "Services" on the left menu. The notification option for 'HTTP' and 'SSH' is disabled by default, so chnage them to enable. Click bell-icon.
 
[5] Click "Enable notifications for this service".
 
[6] Click "Commit" button.
 
[7] Click "Done".
 
[8] The notification option for 'HTTP' is just enabled. Turn enable for SSH too by the same procedure.
 
[9] Try to stop SSH by hand, then turn status for SSH like follows after few minutes.
 
[10] Make sure emailbox, then following email comes.
 
 
Tweet